#include <iostream>
#include <vector>
using namespace std;
void sum_n(int target,vector<int> &v,int begin)
{
    if(target == 0)
    {
        for(auto i:v)
            cout<<i<<" ";
        cout<<"\n";
    }
    for(int i=begin;i<=target;i++)
    {
        v.push_back(i);
        sum_n(target-i,v,i+1);
        v.pop_back();
    }

}
int main() {
    int n = 5;
    int m = 5;
    vector<int> v;
//    cin>>n>>m;
    sum_n(m,v,1);
    return 0;
}